﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.Master" CodeBehind="distributors.aspx.vb" Inherits="VerisEdiWebsite.distributors"
    Title="Our Distributors" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="main">
        <div>
            <h1>Our Distributor Locator and Directory</h1>
            <p>Local distributor pages provide distributor contact details, office addresses, driving directions and more.</p>
        </div>
        <div>
            <p>
                <b>Please select you country from the list below</b>
            </p>
            <asp:DropDownList ID="ddl_Countries" runat="server" CssClass="padded" DataSourceID="ds_Countries" DataTextField="DistributorCountry" DataValueField="DistributorCountry" OnSelectedIndexChanged="ddl_Countries_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
            <asp:SqlDataSource ID="ds_Countries" runat="server" ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\VerisEdiDB.accdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [DistributorCountry] FROM [Distributors] ORDER BY [DistributorCountry], [DistributorContinent], [DistributorCity]"></asp:SqlDataSource>
        </div>
        <div style="clear: right;"></div>
        <div>
            <asp:UpdatePanel ID="up_Distributors" runat="server">
                <ContentTemplate>
                    <%--<asp:DetailsView ID="DetailsView1" runat="server" CssClass="cbl" AutoGenerateRows="False" DataKeyNames="ID" DataSourceID="ds_Distributors" EnableModelValidation="True" BorderStyle="None">
                <Fields>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="lbl_Name" runat="server" Text="Contact Name: " AssociatedControlID="lbl_contactName"></asp:Label>
                            <asp:Label ID="lbl_contactName" runat="server" Text='<%# Eval("DistributorContactName")%>'></asp:Label>
                            <br />
                            <br />
                            <asp:Label ID="lbl_coName" runat="server" Text="Distributor: " AssociatedControlID="lbl_companyName"></asp:Label>
                            <asp:Label ID="lbl_companyName" runat="server" Text='<%# Eval("DistributorName")%>'></asp:Label>
                            <br />
                            <br />
                            <asp:Label ID="lbl_add" runat="server" Text="Address: " AssociatedControlID="lbl_address"></asp:Label>
                            <asp:Label ID="lbl_address" runat="server" Text='<%# Eval("DistributorAddress")%>'></asp:Label>
                            <br />
                            <asp:Label ID="lbl_city" runat="server" Text='<%# Eval("DistributorCity")%>'></asp:Label>
                            <br />
                            <asp:Label ID="lbl_zip" runat="server" Text='<%# Eval("DistributorZip")%>'></asp:Label>
                            <br />
                            <asp:Label ID="lbl_country" runat="server" Text='<%# Eval("DistributorCountry")%>'></asp:Label>
                            <br />
                            <br />
                            <asp:Label ID="lbl_ph" runat="server" Text="Phone: " AssociatedControlID="lbl_phone"></asp:Label>
                            <asp:Label ID="lbl_phone" runat="server" Text='<%# Eval("DistributorPhone")%>'></asp:Label>
                            <br />
                            <asp:Label ID="lbl_f" runat="server" Text="Fax: " AssociatedControlID="lbl_fax"></asp:Label>
                            <asp:Label ID="lbl_fax" runat="server" Text='<%# Eval("DistributorFax")%>'></asp:Label>
                            <br />
                            <br />
                            <asp:Label ID="lbl_e" runat="server" Text="Email: " AssociatedControlID="hl_email"></asp:Label>
                            <asp:HyperLink ID="hl_email" runat="server" Text='<%# Eval("DistributorEmail")%>'></asp:HyperLink>
                            <br />
                            <asp:Label ID="lbl_w" runat="server" Text="Website: " AssociatedControlID="hl_website"></asp:Label>
                            <asp:HyperLink ID="hl_website" runat="server" Text='<%# Eval("DistributorWebsite")%>' NavigateUrl='<%# Eval("DistributorWebsite")%>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Fields>
            </asp:DetailsView>--%>
                    <div class="cbl">
                        <asp:Repeater ID="rp_Distributors" runat="server" DataSourceID="ds_Distributors" OnItemDataBound="rp_Distributors_ItemDataBound">
                            <ItemTemplate>
                                <asp:Label ID="lbl_coName" runat="server" Visible="false" Text="Distributor: " AssociatedControlID="lbl_companyName"></asp:Label>
                                <asp:Label ID="lbl_companyName" runat="server" Text='<%# Eval("DistributorName")%>'></asp:Label>
                                <br />
                                <br />
                                <asp:Label ID="lbl_add" runat="server" Text="Address: " AssociatedControlID="lbl_address"></asp:Label>
                                <p>
                                    <asp:Label ID="lbl_address" runat="server" Text='<%# Eval("DistributorAddress")%>'></asp:Label>
                                    <br />
                                    <asp:Label ID="lbl_city" runat="server" Text='<%# Eval("DistributorCity")%>'></asp:Label>
                                    <br />
                                    <asp:Label ID="lbl_zip" runat="server" Text='<%# Eval("DistributorZip")%>'></asp:Label>
                                    <br />
                                    <asp:Label ID="lbl_country" runat="server" Text='<%# Eval("DistributorCountry")%>'></asp:Label>
                                </p>
                                <asp:Label ID="lbl_ph" runat="server" Text="Phone: " AssociatedControlID="lbl_phone"></asp:Label>
                                <asp:Label ID="lbl_phone" runat="server" Text='<%# "+" & Eval("DistributorPhone")%>'></asp:Label>
                                <br />
                                <asp:Label ID="lbl_f" runat="server" Text="Fax: " AssociatedControlID="lbl_fax"></asp:Label>
                                <asp:Label ID="lbl_fax" runat="server" Text='<%# "+" & Eval("DistributorFax")%>'></asp:Label>
                                <br />
                                <br />
                                <asp:Label ID="lbl_e" runat="server" Text="Email: " AssociatedControlID="hl_email"></asp:Label>
                                <asp:HyperLink ID="hl_email" runat="server" Text='<%# Eval("DistributorEmail")%>'></asp:HyperLink>
                                <br />
                                <asp:Label ID="lbl_w" runat="server" Text="Website: " AssociatedControlID="hl_website"></asp:Label>
                                <asp:HyperLink ID="hl_website" runat="server" Text='<%# Eval("DistributorWebsite")%>' NavigateUrl='<%# "http://" & Eval("DistributorWebsite")%>'></asp:HyperLink>
                                <asp:HiddenField ID="gmapSrc" runat="server" Value='<%# Eval("DistributorMap")%>' />
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                    <asp:SqlDataSource ID="ds_Distributors" runat="server" ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\VerisEdiDB.accdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT * FROM [Distributors] WHERE ([DistributorCountry] = ?)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ddl_Countries" Name="DistributorCountry" PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <iframe id="gmap" runat="server" frameborder="0" style="border: 0; min-height: 17em" class="cbl"
                        src="https://www.google.com/maps/embed/v1/place?key=AIzaSyDRO8Tg5nSbFyAa4DOnqgnN5XtywTb-ya0&q=Edi,Redwood+City+CA" allowfullscreen></iframe>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="ddl_Countries" EventName="SelectedIndexChanged" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </div>
</asp:Content>
